package org.mashibing.service.impl;

import org.mashibing.dto.ResponseResult;
import org.mashibing.remote.ServicePriceClient;
import org.mashibing.request.ForecastPriceDTO;
import org.mashibing.response.ForecastPriceResponse;
import org.mashibing.service.ForecastPriceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author:
 * @create: 2024/4/2 14:28
 * @description:
 */
@Service
public class ForecastPriceServiceImpl implements ForecastPriceService {

    @Autowired
    ServicePriceClient servicePriceClient;

    @Override
    public ResponseResult<ForecastPriceResponse> forecastPrice(String depLongitude,
                                                               String depLatitude,
                                                               String destLongitude,
                                                               String destLatitude,
                                                               String cityCode,
                                                               String vehicleType) {

        ForecastPriceDTO forecastPriceDTO = new ForecastPriceDTO();
        forecastPriceDTO.setDepLongitude(depLongitude);
        forecastPriceDTO.setDepLatitude(depLatitude);
        forecastPriceDTO.setDestLongitude(destLongitude);
        forecastPriceDTO.setDestLatitude(destLatitude);
        forecastPriceDTO.setCityCode(cityCode);
        forecastPriceDTO.setVehicleType(vehicleType);

        // 调用计价服务，计算价格
        return servicePriceClient.forecastPrice(forecastPriceDTO);
    }
}
